﻿using System.Security.Cryptography;

namespace WXWorkSvc.Common.Extensions;

public static class MD5Extension
{
    public static string ToMD5(this string input)
    {
        using var md5 = MD5.Create();
        var bs = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
        StringBuilder stringBuilder = new StringBuilder(32);
        foreach (var b in bs)
            stringBuilder.Append(b.ToString("x2"));
        return stringBuilder.ToString();
    }
}
